import {createRouter, createWebHistory} from "vue-router";
import routeConfig from "./route-config.js";
const routeModules = import.meta.glob('./customRouter/*.js', {eager: true})
const routes = [...routeConfig, ...Object.values(routeModules).flatMap(mod => mod.default || [])];
import NProgress from 'nprogress';
//跳转进度
NProgress.configure({showSpinner: false})

const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

router.beforeEach((to, from, next) => {
    NProgress.start()
    next()
})
router.afterEach(() => {
    NProgress.done()
})

export default router
